<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
	<title>尚小惠商城--秒杀页面</title>
	<link rel="icon" href="/assets/img/favicon.ico">


    <link rel="stylesheet" type="text/css" href="css/webbase.css" />
    <link rel="stylesheet" type="text/css" href="css/widget-jquery.autocomplete.css" />
		<link rel="stylesheet" type="text/css" href="css/pages-seckill-index.css" />
		
</head>

<body>

	<!-- 头部栏位 -->
	<!--页面顶部，由js动态加载-->
	<script type="text/javascript" src="plugins/jquery/jquery.min.js"></script>
	<div id="nav-bottom"></div>
    <script type="text/javascript">$("#nav-bottom").load("top.html");</script>
	

<script type="text/javascript" src="js/plugins/jquery/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
	$("#service").hover(function(){
		$(".service").show();
	},function(){
		$(".service").hide();
	});
	$("#shopcar").hover(function(){
		$("#shopcarlist").show();
	},function(){
		$("#shopcarlist").hide();
	});

})
</script>
<script type="text/javascript" src="js/plugins/sui/sui.min.js"></script>
<script type="text/javascript" src="js/widget/jquery.autocomplete.js"></script>
<script type="text/javascript" src="js/widget/nav.js"></script>
<script type="text/javascript" src="js/pages/seckill-index.js"></script>
<script>
	   $(function(){
		   $("#code").hover(function(){
			   $(".erweima").show();
		   },function(){
			   $(".erweima").hide();
		   });
	   })
	</script>
</body>

	<div class="py-container index">
		<!--banner-->
		<div class="banner">
			<img src="img/_/banner.png" class="img-responsive" alt="">
		</div>

		<!--商品列表-->
		<div class="goods-list" id="account">
			<ul class="seckill" id="seckill">

				<li class="seckill-item" v-for="(se,index) in seckills"  >
					<div class="pic" href="seckill-item.html">
						<img :src="se.sku.images" alt=''  >
					</div>
					<div class="intro"><span>{{se.title}}</span></div>
					<div class='price'><b class='sec-price'>￥{{ly.formatPrice(se.price)}}</b><b class='ever-price'>￥{{ly.formatPrice(se.sku.price)}}
					</b></div>
					<a v-if="se.num != 0" class='sui-btn btn-block btn-buy' :href="'seckill-item.html?id='+se.id" target='_blank'>立即抢购</a>
					<a v-if="se.num == 0" class='sui-btn btn-block btn-buy' :href="'seckill-item.html?id='+se.id" target='_blank'>售空</a>
				</li>

			</ul>
		</div>


		<div class="cd-top">
			<div class="top">
				<img src="img/_/gotop.png" />
				<b>TOP</b>
			</div>
			<div class="code" id="code">
				<span><img src="img/_/code.png"/></span>
			</div>
			<div class="erweima">
				<img src="img/_/erweima.jpg" alt="">
				<s></s>
			</div>
		</div>
	</div>

	<!-- 底部栏位 -->
	<!--页面底部，由js动态加载-->
	<div class="clearfix footer"></div>
	<script type="text/javascript">$(".footer").load("foot.html");</script>
	<!--页面底部END-->

	<script src="./js/vue/vue.js"></script>
	<script src="./js/axios.min.js"></script>
	<script src="./js/common.js"></script>
	<script src="./js/plugins/jquery/jquery.cookie.js"></script>
	<script src="./js/pages/formatDate.js"></script>
	<script type="text/javascript">
    var vm = new Vue({
        el: "#account",
        data: {
            ly,
            seckills : [],
        },
        computed:{
            totalPrice() {
                return ly.formatPrice(this.order.orderDetails.reduce((c1, c2) => c1 + c2.num * c2.price, 0));
            }
        },
        created() {
            ly.http.get("/auth/verify").then(res => {
                ly.http.get("/seckill").then(res => {
                    this.seckills = res.data;
                })
            }).catch(() => {
                this.gotoLogin();
            })
    
        },
        filters: {
            formatDate(time) {
                var date = new Date(time);
                return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
            }
        },
        methods: {
            logout() {
                // 删除cookie中的token即可
                Cookies.remove("LY_TOKEN",{
                    path:"/",
                    domain:"leyou.com"
                });
                window.location = 'http://www.leyou.com'
            },
            gotoLogin() {
                window.location = "login.html?returnUrl=" + window.location;
            },
        },
        watch:{
            'query':{
                deep:true,
                handler(){
                    this.loadOrder();
                }
            }
        }
    });
</script>


</html>